package com.qf.proxy3;
import net.sf.cglib.proxy.Enhancer;
//CGLib动态代理：比jdk动态代理效率高些
//测试类
public class Test {
    public static void main(String[] args) {
        //模板
        ProxyTemplate proxyTemplate = new ProxyTemplate();
        //获取变形机器
        Enhancer enhancer = new Enhancer();
        //将模板和电脑工厂放入enhancer
        enhancer.setCallback(proxyTemplate);
        enhancer.setSuperclass(ComputerFactory.class);
        //生成代理对象
        ComputerFactory computerFactory=(ComputerFactory)enhancer.create();
        computerFactory.saleComputer();
    }
}

